<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/admin/include/init_admin.jsp" %>
<%@ page import="com.welfare.admin.system.*" %>
<%
	HashList codeUseYn	= CommonUtil.getCodeList("use_yn");		//사용여부
	

	String popup_id	= StringUtil.nvl(request.getParameter("popup_id"));

	String job_type		= "".equals(popup_id) ? "C" : "U";


	HashMap infos = new HashMap();
	infos.put("popup_id",	popup_id);


	SystemDAO dao 		= new SystemDAO();
	HashList list 		= dao.selectPopupInfo(infos);	

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title><%= SYSTEM_NAME %></title>
	<%@ include file="/admin/include/cssnjs.jsp"  %>
	<script type="text/javascript" src="../../SE2.3.1.O9858/js/HuskyEZCreator.js" charset="utf-8"></script>

	<script type="text/javascript">
	var oEditors = [];
	
	$(document).ready(function() {
		
		cfInitSE("content_info");

		$('#start_dt').mask('9999.99.99').datepicker();
		$('#end_dt').mask('9999.99.99').datepicker();
		$('#popup_width').numeric();
		$('#popup_height').numeric();
	});


	function fnSave() {
		if (cfCheckRequired(document.saveForm.popup_name, '팝업명을 입력하세요')
				&& cfCheckRequired(document.saveForm.start_dt, '게시 시작일을 선택하세요')
				&& cfCheckRequired(document.saveForm.end_dt, '게시 종료일을 입력하세요')
		) {
			if (confirm(MSG_<%=job_type%>)) {
				oEditors.getById["content_info"].exec("UPDATE_CONTENTS_FIELD", []);
				$('#saveForm').attr('action', './popupSave.do');
				$('#saveForm').submit();
			}
		}
	}

	function fnPreview() {
		cfOpen('/popup.jsp?popup_id=<%=popup_id%>', 'win_popup', document.saveForm.popup_width.value, document.saveForm.popup_height.value);
	}
				
			

	</script>
</head>
<body>
<div id="wrap">
	<div id="page">
		<div id="contents">
			<div class="menu_title">
				<h1>팝업관리</h1>
				<p>관리자 > 복지자원관리 > <b>팝업관리</b></p>
			</div>
			<div class="clear line_01"></div>




			<form name="saveForm" id="saveForm" method="post" action="">
			<input type="hidden" name="job_type" id="job_type" value="<%= job_type %>"/>
			<input type="hidden" name="popup_id" value="<%= list.get("popup_id", 0) %>"/>
			<input type="hidden" name="target" value="_self"/>
				

			<div class="mt15 ">

				<table cellpadding="0" cellspacing="0" class="table_01 mt5">
				<colgroup>
					<col width="100px"/>
					<col width="400px"/>
					<col width="100px"/>
					<col/>
				</colgroup>
				<tbody>
					<tr>
						<th><p>팝업명*</p></th>
						<td colspan="3" class="brx">
							<input type="text" name="popup_name" class="wmax" value="<%= list.get("popup_name", 0) %>"  />
						</td>
					</tr>
					<tr>
						<th><p>게시일</p></th>
						<td>
							<input type="text" name="start_dt" id="start_dt" class="w90 c" value="<%= StringUtil.nvl(list.get("start_dt", 0), TODAY) %>"  />
							~
							<input type="text" name="end_dt" id="end_dt" class="w90 c" value="<%= list.get("end_dt", 0) %>"  />
						</td>
						<th><p>팝업크기</p></th>
						<td class="brx">
							<input type="text" name="popup_width" id="popup_width" class="w90" value="<%= list.get("popup_width", 0) %>"  />
							X
							<input type="text" name="popup_height" id="popup_height" class="w90" value="<%= list.get("popup_height", 0) %>"  />
						</td>
					</tr>
					<tr>
						<th><p>내용</p></th>
						<td colspan="3" class="brx">
							<textarea name="content_info" id="content_info" style="width:860px; height:400px"><%= list.get("content_info", 0) %></textarea>
						</td>
					</tr>
					<tr>
						<th><p>사용여부</p></th>
						<td>
							<%= StringUtil.makeRadio(codeUseYn, "use_yn", list.get("use_yn", 0)) %>
						</td>
						<th><p>최종수정일</p></th>
						<td class="brx">
							<%= list.getDate("mod_date", 0) %> <%= list.get("mod_user", 0) %>
						</td>
					</tr>
				</tbody>
				</table>

			</div>
			
			<div class="mt20 mb10 c">
				<a href="./popupList.jsp" ><img src="../images/btn_list.gif" /></a>
		<%	if ("U".equals(job_type)) { %>
				<a href="#nohref" onclick="fnPreview()"><img src="../images/btn_preview.gif" /></a>
				<a href="#nohref" onclick="fnSave()"><img src="../images/btn_save.gif" /></a>
		<%	} else if ("C".equals(job_type)) { %>
				<a href="#nohref" onclick="fnSave()"><img src="../images/btn_register.gif" /></a>
		<%	} %>
			</div>

			</form>
		</div>
	</div>
</div>

</body>
</html>
